<?php 
define('INCLUDE_CHECK',true);
require 'connect.php';
include_once("utility.class.php"); 
session_name('tzLogin');
session_start();  


switch($action) 
{
    case 'save' :
        $utility = new Utility(); 
        date_default_timezone_set($utility->getLocalTimezone());

        $date = date('Y-m-d G:i:s');
        $doc_id = $_POST['doc_id'];
        $content = mysql_real_escape_string(json_decode($_POST['content'])); 
        
        $query = sprintf("UPDATE documents SET content='$content', date_updated='$date' WHERE doc_id=$doc_id"); 
        mysql_query($query);  
        
        echo $date; 
        break;  
}

?>
